package com.zj.small.controller;

import com.zj.small.mapper.UserMapper;
import com.zj.small.pojo.User;
import com.zj.small.service.SendEmail;
import com.zj.small.util.FeedbackData;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class FeedbackController {
    @Autowired
    private UserMapper userMapper;
    @Autowired
    private SendEmail sendEmail;
    @PostMapping("/feedback") // 使用 POST 请求
    public String feedback(@RequestBody FeedbackData feedbackData){
        String feedback = feedbackData.getFeedback();
        if (feedback != null && !feedback.isEmpty()) {
            // 处理反馈信息

            System.out.println("收到反馈信息: " + feedback);
            sendEmail.sendFeedback("2976245573@qq.com",feedback);


        }
        return "success";
    }
}
